//
//  PrescriptionOrderAddressCell.swift
//  EyeVisionForPatients
//
//  Created by PMC on 2020/3/3.
//  Copyright © 2020 tao Tao. All rights reserved.
//

import UIKit

class PrescriptionOrderAddressCell: UITableViewCell {

    override func awakeFromNib() {
        super.awakeFromNib()
        backgroundColor = .clear
        contentView.backgroundColor = .clear
    }
    
    @IBOutlet weak var iconView: UIImageView!
    
    @IBOutlet weak var nameLabel: UILabel!
    
    @IBOutlet weak var phoneLabel: UILabel!
    
    @IBOutlet weak var addressLabel: UILabel!
    
    @IBOutlet weak var arrowView: UIImageView!
    
    func bind(to viewModel: PrescriptionOrderDetailCellViewModel) {
        iconView.image = UIImage(named: "profile_address")
        arrowView.isHidden = !viewModel.addressClickEnable
        switch viewModel.receiveType {
        case .express:
            nameLabel.text = viewModel.receiverName
            phoneLabel.text = viewModel.receiverPhone
            addressLabel.text = viewModel.receiverAddress
        case .drugstore:
            nameLabel.text = "药房"
            phoneLabel.text = ""
            addressLabel.text = "温州市鹿城区环城东路115号101室"
        case .hospital:
            nameLabel.text = viewModel.hospitalName
            phoneLabel.text = viewModel.hospitalPhone
            addressLabel.text = viewModel.hospitalAddress
        default: break
        }
    }
}
